<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
         :root,
        body {
            height: 100%;
            background: linear-gradient(to top, #434444, #686969);
        }
        
        .Box {
            display: flex;
            justify-content: center;
            height: 400px;
        }
        
        .box {
            /* width: 200px; */
            /* height: 200px; */
            margin: 250px 100px;
            /* border: 5px solid gray; */
            transform-style: preserve-3d;
            position: relative;
            /* animation: run 5s linear infinite; */
            /* transform: rotateY(327deg)rotateX(314deg); */
            transition: all 2s ease;
        }
        
        .box div {
            width: 200px;
            height: 200px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin-top: -100px;
            margin-left: -100px;
            line-height: 200px;
            text-align: center;
            font-size: 180px;
            font-weight: 900;
            color: white;
        }
        /* 六个面位置设置 */
        
        .box div:nth-child(1) {
            background: gray;
            transform: translateZ(100px);
        }
        
        .box div:nth-child(2) {
            background: rgb(144, 144, 144);
            transform: translateX(-100px) rotateY(-90deg);
        }
        
        .box div:nth-child(3) {
            background: rgb(138, 138, 138);
            transform: translateY(-100px) rotateX(90deg);
        }
        
        .box div:nth-child(4) {
            background: rgb(151, 151, 151);
            transform: translateY(100px) rotateX(-90deg);
        }
        
        .box div:nth-child(5) {
            background: rgb(211, 211, 211);
            transform: translateX(100px) rotateY(90deg);
        }
        
        .box div:nth-child(6) {
            background: gray;
            transform: translateZ(-100px) rotateX(180deg);
        }
        /* 四个方块控制 */
        
        .Box .box:nth-child(1) {
            transform: rotateY(327deg) rotateX(291deg);
        }
        
        .Box .box:nth-child(2) {
            transform: rotateY(327deg) rotateX(291deg);
        }
        
        .Box .box:nth-child(3) {
            transform: rotateY(327deg) rotateX(111deg);
        }
        
        .Box .box:nth-child(4) {
            transform: rotateY(327deg) rotateX(288deg);
        }
        /*控制最后两个旋转*/
        
        .Box:hover .p4 {
            transform: rotateY(327deg) rotateX(648deg);
        }
        
        .Box:hover .p3 {
            transform: rotateY(327deg) rotateX(-69deg);
        }
        
        .Box:hover .p2 {
            transform: rotateY(327deg) rotateX(651deg);
        }
        
        .Box:hover .p1 {
            transform: rotateY(327deg) rotateX(-70deg);
        }
        
        @keyframes run {
            0% {
                transform: rotateY(327deg) rotateX(0deg);
            }
            50% {
                transform: rotateY(327deg) rotateX(180deg);
            }
            100% {
                transform: rotateY(327deg) rotateX(360deg);
            }
        }
    </style>
</head>

<body>
    <div class="Box">
        <div class="box p1">
            <div>3</div>
            <div></div>
            <div>2</div>
            <div>4</div>
            <div></div>
            <div>1</div>
        </div>
        <div class="box p2">
            <div>1</div>
            <div></div>
            <div>0</div>
            <div>2</div>
            <div></div>
            <div>3</div>
        </div>
        <div class="box p3">
            <div>3</div>
            <div></div>
            <div>2</div>
            <div>0</div>
            <div></div>
            <div>1</div>
        </div>
        <div class="box p4">
            <div>3</div>
            <div></div>
            <div>2</div>
            <div>4</div>
            <div></div>
            <div>1</div>
        </div>
    </div>

</body>

</html>